<!--业务参数维护-->
<template>
  <div class="app-container">
    <ht-search-form
      v-show="showSearch"
      :dictMap="dictMap"
      :labelWidth="100"
      :queryParams="queryParams"
      :outputQueryParams="queryParams"
      :formOptions="formOptions"
      :advOptions="[]"
      :defaultEventKey="defaultEventKey"
    ></ht-search-form>
    <ht-table
      ref="dataTable"
      rowKey="sysFlg,orgNo,paraCode"
      :showSerialNumber="false"
      :multi-select="false"
      :dictMap="dictMap"
      :reqConfig="reqConfig"
      :queryParams="queryParams"
      :tableBindColumns="tableBindColumns"
      :opButtonList="opButtonList"
    >
      <template v-slot:operate>
        <el-table-column label="操作" align="left" width="120px" fixed="right" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <ht-button-group
              :buttonList="[
                {
                  label: '修改',
                  doFunc: () => {
                    edit(scope.row);
                  },
                },
              ]"
            />
          </template>
        </el-table-column>
      </template>
    </ht-table>

    <biz-para-add-dialog ref="bizParaAddDialog" @editComplete="editComplete"></biz-para-add-dialog>

    <biz-para-edit-dialog ref="bizParaEditDialog" @editComplete="editComplete"></biz-para-edit-dialog>
  </div>
</template>
<script>
import { bizMngMainUrlConfig } from "@/api/cnaps/bizMng/paraMng.js";
import { listPageMixin } from "@/libs/listPageMixin";
import BizParaAddDialog from "./addDialog";
import BizParaEditDialog from "./editDialog";

export default {
  name: "bizPara_maintain",
  mixins: [listPageMixin],
  components: {
    BizParaAddDialog,
    BizParaEditDialog,
  },
  props: {},
  data() {
    return {
      reqConfig: bizMngMainUrlConfig,
      defaultEventKey: "",
      //数据字典
      searchFormDictList: [],
      // 遮罩层
      loading: true,
      // 弹出层标题
      title: "",
      showSearch: true,
      // 日期范围
      dateRange: [],
      // 查询参数
      queryParams: {
        paraCode:"",
        paraName:"",
        sysFlg:"",
      },
      formOptions: [],
      /*opButtonList: () => {
        return [
          {
            label: "新增",
            type: "primary",
            icon: "el-icon-plus",
            actionType: "add",
            clickFun: () => {
              this.add();
            },
          },
        ];
      },*/
      tableBindColumns: [
        { label: `系统号`, prop: "sysFlg", align: "center" },
        { label: `内部机构号`, prop: "orgNo", align: "center", },
        { label: `内部机构名称`, prop: "orgname", align: "center" },
        { label: `参数代码`, prop: "paraCode", align: "center" },
        { label: `参数名称`, prop: "paraName", align: "center" },
        { label: `参数值`, prop: "paraValue", align: "center" },
      ],
    };
  },
  mounted() {
    this.formOptions = [
      {
        type: "input",
        prop: "sysFlg",
        defaultAttr: {
          label: "系统号",
          placeholder: "请输入系统号",
        },
      },
      {
        type: "input",
        prop: "paraCode",
        defaultAttr: {
          label: "参数代码",
          placeholder: "请输入参数代码",
        },
      },
      {
        type: "input",
        prop: "paraName",
        defaultAttr: {
          label: "参数名称",
          placeholder: "请输入参数名称",
        },
      },
    ];
  },
  methods: {
    /** todo 查询当天操作员的交易记录 */
    getList() {
      this.doQuery();
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRange = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    add() {
      console.log("this.$refs.bizParaAddDialog", this.$refs.bizParaAddDialog);
      this.$refs.bizParaAddDialog.show();
    },
    edit(row) {
      console.log("this.$refs.bizParaEditDialog", this.$refs.bizParaEditDialog);
      this.$refs.bizParaEditDialog.show(row);
    },
    editComplete(state) {
      console.log("editComplete", state);
      if (state == true) {
        this.getList();
      }
    },
  },
};
</script>
<style>
.label-header-msg {
  font-weight: bold;
}
</style>
